#include <iostream>
#include "netpp.h"
using namespace std;

int main(){
	int server = NewHttpServe();
	StartHttpServe(to_gostr(":6140"), server);
	
	int conn_p = ListenHttp(to_gostr("/index"), server);
	
	while(1){
		if(HasConn(conn_p)){
			int conn = GetHttpConn(conn_p);
			GoString buf{nullptr, 0};
			ReadFromHttpConn(conn, &buf);
			
			string say = "hi ";
			int err = WriteToHttpConn(conn, to_gostr(say+buf.p));
			if(err < 0)
				PrintError(err);
			
			Close(conn);
		}
	}
	return 0;
}
